********************************************************************************
* Replication data for "Do Voters Care about the Age of their Elected Representatives?"
*
* Survey analysis: Legislator age and approval of members of Congress
* 2006-2020 pooled Cooperative Election Studies
********************************************************************************

* Main models: Age of representative and constituent approval
********************************************************************************

* Table 1, column 1: main effects of legislator age
meologit mcapp mcage ager c.dwnom##c.ideo5 ownmc leff mctenure brep lrep arep frep educ female black latino [pweight=weight] || fipsy: ideo5, cov(un)

* Table 1, column 2: conditional effects of legislator age by respondent age
meologit mcapp c.mcage##c.ager c.dwnom##c.ideo5 ownmc leff mctenure brep lrep arep frep educ female black latino [pweight=weight] || fipsy: ager ideo5, cov(un)

* Predicted values and marginal effects, results reported in Table 1
********************************************************************************

* Figure 3: Marginal effect of representative age on approval, by respondent age
margins, dydx(mcage) at(ager=(0.18(0.10)0.88)) expression(predict(outcome(2))+predict(outcome(3)))

* Figure 4: predicted approval based on respondent age and representative age
margins, at(mcage=(30(10)80)) expression(predict(outcome(2))+predict(outcome(3)))

* Predicted values of control variables discussed in results section
margins, at(dwnom=-0.745 ideo5=(0(4)4)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(dwnom=0.883 ideo5=(0(4)4)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(ownmc=(0(1)1)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(mctenure=(0(10)60)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(brep=(0(1)1)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(lrep=(0(1)1)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(arep=(0(1)1)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(frep=(0(1)1)) expression(predict(outcome(2))+predict(outcome(3)))

* Alternate specifications reported in appendix
********************************************************************************

* Table A5: robustness check that includes partisanship controls
meologit mcapp mcage ager c.dwnom##c.ideo5 ownmc leff mctenure mcdem brep lrep arep frep pid educ female black latino [pweight=weight] || fipsy: ideo5, cov(un)
meologit mcapp c.mcage##c.ager c.dwnom##c.ideo5 ownmc leff mctenure mcdem brep lrep arep frep pid educ female black latino [pweight=weight] || fipsy: ager ideo5, cov(un)

* Table A6: three-way interaction of respondent age, MC age, and shared partisanship
meologit mcapp c.mcage##c.ager##ownmc c.dwnom##c.ideo5 leff mctenure brep lrep arep frep educ female black latino [pweight=weight] || fipsy: ager ideo5, cov(un)

* Figure A6: predicted probability of MC approval, as a function of respondent age, MC age, and shared partisanship
margins, at(ager=(0.18) ownmc=0 mcage=(30(10)80)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(ager=(0.18) ownmc=1 mcage=(30(10)80)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(ager=(0.78) ownmc=0 mcage=(30(10)80)) expression(predict(outcome(2))+predict(outcome(3)))
margins, at(ager=(0.78) ownmc=1 mcage=(30(10)80)) expression(predict(outcome(2))+predict(outcome(3)))


